package cn.tedu.reflection;

import java.util.Random;
import java.util.Scanner;

public class LianXi3 {
    public static void main(String[] args) {

        Random r = new Random();
        char[] c = new char[5];
        for (int i = 0; i < 5; i++) {
            int a;
            if (r.nextInt(2) == 0) {
                a = 97 + r.nextInt(26);
            } else {
                a = 65 + r.nextInt(26);
            }
            c[i] = (char) a;
        }
        System.out.println(c);
        String str = String.valueOf(c);
        str=str.toLowerCase();
        System.out.println("请输入上面的验证码，大小写不限制");
        String s = new Scanner(System.in).nextLine();
           s= s.toLowerCase();
        if (str.equals(s)) {
            System.out.println("输入正确");
        } else {
            System.out.println("输入错误");
        }
    }
}